﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Technullogy.Web.UI;

public partial class Default : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        btnDemo.Click += btnDemo_Click;
        if (!IsPostBack)
            BindControls();
    }

    void btnDemo_Click(object sender, EventArgs e)
    {
        BindProperties();
        OnInit(new EventArgs());
    }

    protected void btnPayPal_Click(object sender, EventArgs e)
    {
        Response.Redirect("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2012206");
    }

    private void BindControls()
    {
        cbBotLeft.Checked = RoundedDiv1.RoundBottomLeft;
        cbBotRight.Checked = RoundedDiv1.RoundBottomRight;
        cbTopLeft.Checked = RoundedDiv1.RoundTopRight;
        cbTopRight.Checked = RoundedDiv1.RoundTopRight;
        txtTitle.Text = RoundedDiv1.Title;
        ddlRoundedDivSkin.SelectedValue = RoundedDiv1.EmbeddedSkin.ToString();
    }

    private void BindProperties()
    {
        RoundedDiv1.RoundBottomLeft = cbBotLeft.Checked;
        RoundedDiv1.RoundBottomRight = cbBotRight.Checked;
        RoundedDiv1.RoundTopLeft = cbTopLeft.Checked;
        RoundedDiv1.RoundTopRight = cbTopRight.Checked;
        RoundedDiv1.Title = txtTitle.Text;
        RoundedDivSkin divSkin = (RoundedDivSkin)Enum.Parse(typeof(RoundedDivSkin), ddlRoundedDivSkin.SelectedValue, true);
        RoundedDiv1.EmbeddedSkin = divSkin;
    }
}